#include "unit_test/suite.h"
#include "../GccLibrary1/main_func.h"
#include "../GccLibrary1/RGB_LED_USART.h"
#include "../GccLibrary1/TWI_Master.h"
#include "twi_func_test.h"

int printCHAR(char character, FILE *stream) {
	USART_PutChar(character);
	return 0;
}

FILE uart_str = FDEV_SETUP_STREAM(printCHAR, NULL, _FDEV_SETUP_RW);

void run_1(const struct test_case *test) {
	test_assert_true(test,plus(5,6)==11,"Test result = 11");
}


int main(void) {
	int i;
	
	USART_Init();
	twi_setup();

	sei();
	stdout = &uart_str;
	
	USART_SendStr("Start TWI test\r\n");
	twi_test();
	USART_SendStr("End TWI test\r\n");
	USART_SendStr("Test SendSTR\r\n");
	

	printf("Hello World 2\n\r");
	
	for(i=0;i<20;i++){
		USART_PutChar(i+48);
	}
	
	USART_SendStr("\r\nend\r\n\r\n");

	DEFINE_TEST_CASE(test_1,
	NULL,
	run_1,
	NULL,
	"First test");
	
	DEFINE_TEST_ARRAY(my_tests) = {
		&test_1,
	};

	DEFINE_TEST_SUITE(my_suite,my_tests,"One-test suite");

	test_suite_run(&my_suite);
	
	while(1);
	
}